using System;
using System.Collections.Generic;

namespace BlazorSodDbManager.Models
{
    public class TableInfo
    {
        public string TableName { get; set; } = string.Empty;
        public string? Schema { get; set; }
        public List<ColumnInfo> Columns { get; set; } = new List<ColumnInfo>();
        public List<IndexInfo> Indexes { get; set; } = new List<IndexInfo>();
        public List<ForeignKeyInfo> ForeignKeys { get; set; } = new List<ForeignKeyInfo>();
        public string TableType { get; set; } = string.Empty;
        public int RowCount { get; set; }
    }

    public class ColumnInfo
    {
        public string ColumnName { get; set; } = string.Empty;
        public string DataType { get; set; } = string.Empty;
        public bool IsNullable { get; set; }
        public bool IsPrimaryKey { get; set; }
        public bool IsIdentity { get; set; }
        public bool IsComputed { get; set; }
        public string? DefaultValue { get; set; }
        public int MaxLength { get; set; }
        public int Precision { get; set; }
        public int Scale { get; set; }
        public int OrdinalPosition { get; set; }
    }

    public class IndexInfo
    {
        public string IndexName { get; set; } = string.Empty;
        public bool IsUnique { get; set; }
        public bool IsPrimaryKey { get; set; }
        public bool IsDisabled { get; set; }
        public List<string> ColumnNames { get; set; } = new List<string>();
    }

    public class ForeignKeyInfo
    {
        public string ForeignKeyName { get; set; } = string.Empty;
        public string ReferencedTableName { get; set; } = string.Empty;
        public string? ReferencedSchema { get; set; }
        public List<ForeignKeyColumnPair> ColumnPairs { get; set; } = new List<ForeignKeyColumnPair>();
        public string? DeleteRule { get; set; }
        public string? UpdateRule { get; set; }
    }

    public class ForeignKeyColumnPair
    {
        public string ColumnName { get; set; } = string.Empty;
        public string ReferencedColumnName { get; set; } = string.Empty;
    }
} 